package com.frinder.hadoop.hbase.service;

import com.frinder.hadoop.hbase.base.ResultUtils;
import com.frinder.hadoop.hbase.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.hadoop.hbase.HbaseTemplate;
import org.springframework.stereotype.Service;

/**
 * @author frinder
 * @date 2018/6/28
 * @Description: ${todo}
 */
@Slf4j
@Service
public class UserService {

    @Autowired
    private HbaseTemplate hBaseTemplate;

    public void get() {
        User user = hBaseTemplate.get("t_user", "1",
                (result, i) -> {
                    log.info("Result:{}", result);
                    return ResultUtils.convertToBean(result, User.class);
                }
        );
        log.info("User: {}", user);
    }

}
